<ul class="sidebar-menu" data-widget="tree">
    {% for module in admin_modules %}
        <li class="{% if sonata_admin in module.sonata_admin %}active{% endif %}{% if loop.index == 1 %} first{% endif %} {% if loop.revindex == 1 %} last{% endif %} treeview">
            <a href="#">
                <i class="{{ module.icon }}"></i>
                <span>{{ module.name }}</span>
                <span class="pull-right-container">
                <i class="fa pull-right fa-angle-left"></i>
            </span>
            </a>
            {% if module.children|length > 0 %}
                <ul class="active treeview-menu menu_level_1">
                    {% for item in module.children %}
                        <li class="{% if sonata_admin == item.sonata_admin %}active{% endif %}{% if loop.index == 1 %} first{% endif %}{% if loop.revindex == 1 %} last{% endif %}">
                            <a href="{{ path(item.route_name) }}">
                                <i class="fa fa-angle-double-right" aria-hidden="true"></i>{{ item.name }}
                            </a>
                        </li>
                    {% endfor %}
                </ul>
            {% endif %}
        </li>
    {% endfor %}
</ul>
<script>
    $(document).ready(function () {

    });
</script>